import java.util.ArrayList;

public class zuoye10 {
    private int id;
    private String name;

    public zuoye10(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
    public static void main(String[] args) {
        // 创建一个ArrayList来存储Student对象
        ArrayList<zuoye10> list = new ArrayList<>();
        list.add(new zuoye10(1,"张三"));
        list.add(new zuoye10(2,"李四"));
        list.add(new zuoye10(1,"王五"));
        for (int i = 0; i < list.size(); i++) {
            zuoye10  s =list.get(i);
            if (s.getName().equals("张三")){
                s.setName("张三丰");
            }
            if (s.getName().equals("王五")){
                list.remove(s);
            }
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.println(
                    list.get(i)
            );
        }

    }
}